home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12093 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.uh.edu!usenet
  2. From: Sensarn <txs53132@bayou.uh.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Inline Assembler and OOP
  5. Date: 17 Mar 1996 18:19:06 GMT
  6. Organization: AEtna Insurance Agency
  7. Message-ID: <4ihl2q$5gh@masala.cc.uh.edu>
  8. References: <4iaqcn$mfu@masala.cc.uh.edu> <314B4A90.64BE@symantec.com>
  9. NNTP-Posting-Host: sip-14263.public-dialups.uh.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
  14.  
  15. Walter Bright <wbright@symantec.com> wrote:
  16. >Sensarn wrote:
  17. >< struct double_buffer {
  18. ><     unsigned char *buffer; /* Actual data */
  19. ><     unsigned int buffer_size; /* Actual size of buffer */
  20. ><     double_buffer(int num_lines=200); /* Constructor */
  21. >< };
  22. >< double_buffer::double_buffer(int num_lines) {
  23. ><     asm {
  24. ><         les di,buffer /* Expression syntax error here */
  25. ><         mov cx,buffer_size/2 /* Here too */
  26. ><     }
  27. >< }
  28. >< Is there some reason why I cannot access buffer and buffer_size in the
  29. >< asm statement (even though the asm statement is inside a member
  30. >< function).
  31. >
  32. >The trouble is that 'buffer' can only be accessed through the 'this' pointer. 
  33. >Your asm code needs to be rewritten as:
  34. >    les di,this
  35. >    mov cx,es:buffer_size[di]
  36. >    shr cx,1
  37. >    les di,es:buffer[di]
  38.  
  39. Thanks!
  40.  
  41. -- 
  42. ______________________________
  43.  
  44. Steven Sensarn
  45. E-Mail - txs53132@bayou.uh.edu
  46. ______________________________
  47.  
  48.  
  49.